package app.v1.common.domain.ao.dict;

import app.v1.common.domain.pojo.Dict;
import com.gitee.feizns.quickstart.mybatis.plus.validation.constraints.NotExist;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 字典更新请求参数
 * @author feizns
 * @since 2023/06/10
 */
@Data
public class DictCreateAo {

    /**
     * 字典键
     */
    @NotBlank(message = "字典键不能为空.")
    @Length(max = 255)
    @NotExist(type = Dict.class, field = "`key`")
    private String key;

    /**
     * 字典类型
     */
    @NotBlank(message = "字典类型不能为空.")
    @Length(max = 255)
    private String type;

    /**
     * 字典值
     */
    private String value;

    /**
     * 字典备注
     */
    @Length(max = 255)
    private String comment;

    /**
     * 值类型（string=字符串、integer=整型、number=数字、array=数组、object=对象）
     */
    @NotNull(message = "值类型不能为空.")
    private Dict.ValueType valueType = Dict.ValueType.string;

    /**
     * 访问权限（readonly=只读、readwrite=可读写）
     */
    @NotNull(message = "访问权限不能为空.")
    private Dict.AccessPermission accessPermission = Dict.AccessPermission.readwrite;

}
